<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="../../lib/layui/css/layui.css"/>
    <script src="../../lib/layui/layui.js"></script>
    <script src="../../js/jquery.min.js"></script>
    <script type="text/javascript" src="../../js/xadmin.js"></script>
    <script src="../../js/common.js"></script>
</head>
<body>
<form class="layui-form layui-form-pane" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">添加药品</label>
        <div class="layui-input-inline">
            <select name="drId" lay-verify="required" lay-search="">
                <option value="" id="search2">直接选择或搜索选择</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">药品类型</label>
        <div class="layui-input-block">
            <input type="radio" name="drType" value="1" title="颗粒" checked="">
            <input type="radio" name="drType" value="2" title="袋装颗粒">
            <input type="radio" name="drType" value="3" title="饮片">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">服用方式</label>
        <div class="layui-input-block">
            <input type="radio" name="preTakeType" value="1" title="口服" checked="">
            <input type="radio" name="preTakeType" value="2" title="外用">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用量</label>
        <div class="layui-input-inline">
            <input type="text" name="preConsumptionReal2" lay-verify="required" placeholder="请输入每日吃药次数" autocomplete="off"
                   class="layui-input">
        </div>
        <div class="layui-input-inline">
            <input type="text" name="preConsumptionReal3" lay-verify="required" placeholder="请输入每次吃药的剂量" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label" style="width: 500px;">给药房的备注</label>
        <div class="layui-input-block" style="width: 500px;">
            <textarea placeholder="备注" class="layui-textarea" name="preRemarks"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">保存</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</body>
</html>
<script src="../../js/xadmin.js"></script>
<script src="../../lib/layui/layui.js"></script>
<script>
    layui.use(['element', 'form', 'layedit', 'laydate', 'laytpl'], function () {
        var $ = layui.jquery
            , element = layui.element //Tab的切换功能，切换事件监听等，需要依赖element模块
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate
            , form = layui.form
            , laytpl = layui.laytpl;

        $('.site-demo-active').on('click', function () {
            var othis = $(this), type = othis.data('type');
            active[type] ? active[type].call(this, othis) : '';
        });

        //form表单 监听提交
        form.on('submit(demo1)', function (data) {
            useAjax("/JT90/addPOTCM",data.field,"JSON","GET",function(map){
                layer.msg(map.message);
            })
            return false;
        });

        //添加药品信息
        $(function(){
            useAjax("/JT90/selectDrugsName",null,"JSON","GET",function(data){
                //追加标签 new Option(item.drName,item.drId)   $('#search').next().empty();
                $.each(data.data, function (index, item) {
                    $('#search2').after("<option value='"+item.drId+"'>"+item.drName+"</option>");
                });
                form.render();
            })
        })

    });


</script>
